﻿// -----------------------------------------------------------------------
// <copyright file="IPushApplicationService.cs" company="Zen Design Corp">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Zen.BlackBerry.Push.AppManagement
{
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;

	/// <summary>
	/// Data access interface for a push application.
	/// </summary>
	public interface IPushApplicationRepository
	{
		/// <summary>
		/// Adds the specified push application to the persistent store.
		/// </summary>
		/// <param name="application">The application.</param>
		void AddPushApplication(PushApplication application);

		/// <summary>
		/// Change the enterprise username and password of a push application that has a type of Enterprise Push or Public+Enterprise Push.
		/// </summary>
		/// <param name="id">The id.</param>
		/// <param name="currentUsername">The current username.</param>
		/// <param name="newUsername">The new username.</param>
		/// <param name="currentPassword">The current password.</param>
		/// <param name="newPassword">The new password.</param>
		/// <param name="modifiedBy">The modified by.</param>
		void ChangePushApplicationEnterpriseCredentials(string id, string currentUsername, string newUsername, string currentPassword, string newPassword, string modifiedBy);

		/// <summary>
		/// Change the public password of a push application that has a type of Public Push, Web Signal, or Public+Enterprise Push.
		/// </summary>
		/// <param name="id">The id.</param>
		/// <param name="currentPassword">The current password.</param>
		/// <param name="newPassword">The new password.</param>
		/// <param name="modifiedBy">The modified by.</param>
		void ChangePushApplicationPublicCredentials(string id, string currentPassword, string newPassword, string modifiedBy);

		/// <summary>
		/// Changes the push application type from Enterprise to Public+Enterprise.
		/// </summary>
		/// <param name="id">The id.</param>
		/// <param name="publicPassword">The public password.</param>
		/// <param name="publicNotifyUrl">The public notify URL.</param>
		/// <param name="modifiedBy">The modified by.</param>
		void ChangePushApplicationTypeFromEnterpriseToPublicAndEnterprise(string id, string publicPassword, string publicNotifyUrl, string modifiedBy);

		/// <summary>
		/// Changes the push application type from Public to Public+Enterprise.
		/// </summary>
		/// <param name="id">The id.</param>
		/// <param name="enterpriseUsername">The enterprise username.</param>
		/// <param name="enterprisePassword">The enterprise password.</param>
		/// <param name="enterpriseNotifyUrl">The enterprise notify URL.</param>
		/// <param name="modifiedBy">The modified by.</param>
		void ChangePushApplicationTypeFromPublicToPublicAndEnterprise(string id, string enterpriseUsername, string enterprisePassword, string enterpriseNotifyUrl, string modifiedBy);

		/// <summary>
		/// Deletes the push application.
		/// </summary>
		/// <param name="id">The id.</param>
		/// <param name="deletedBy">The deleted by.</param>
		void DeletePushApplication(string id, string deletedBy);

		/// <summary>
		/// Disables the push application.
		/// </summary>
		/// <param name="id">The id.</param>
		/// <param name="modifiedBy">The modified by.</param>
		void DisablePushApplication(string id, string modifiedBy);

		/// <summary>
		/// Enables the push application.
		/// </summary>
		/// <param name="id">The id.</param>
		/// <param name="modifiedBy">The modified by.</param>
		void EnablePushApplication(string id, string modifiedBy);

		/// <summary>
		/// Enables the push application.
		/// </summary>
		/// <param name="id">The id.</param>
		/// <param name="expiryDate">The expiry date.</param>
		/// <param name="modifiedBy">The modified by.</param>
		void EnablePushApplication(string id, DateTime expiryDate, string modifiedBy);

		/// <summary>
		/// Finds the push application with the specified id.
		/// </summary>
		/// <returns>
		/// A <see cref="PushApplication"/> or <c>null</c> if no push
		/// application is found.
		/// </returns>
		IEnumerable<PushApplication> FindAll();

		/// <summary>
		/// Finds the push application with the specified application-id.
		/// </summary>
		/// <param name="id">The id.</param>
		/// <returns>
		/// A <see cref="PushApplication"/> or <c>null</c> if no push
		/// application is found.
		/// </returns>
		PushApplication FindById(Guid id);

		/// <summary>
		/// Finds the push application with the specified application-id and
		/// validates whether pushes can be sent at this time.
		/// </summary>
		/// <param name="id">The id.</param>
		/// <returns>
		/// A <see cref="PushApplication"/> or <c>null</c> if no push
		/// application is found.
		/// </returns>
		PushApplication FindByAppId(string id);

		/// <summary>
		/// Finds the push application with the specified name.
		/// </summary>
		/// <param name="name">The name.</param>
		/// <returns>
		/// A <see cref="PushApplication"/> or <c>null</c> if no push
		/// application is found.
		/// </returns>
		PushApplication FindByName(string name);

		/// <summary>
		/// Finds a list of push applications that are in the specified state.
		/// </summary>
		/// <param name="status">The status.</param>
		/// <returns>
		/// A collection of <see cref="PushApplication"/> objects.
		/// </returns>
		IEnumerable<PushApplication> FindByStatus(PushApplicationStatus status);

		/// <summary>
		/// Finds a list of push applications that are of the specified type.
		/// </summary>
		/// <param name="type">The type.</param>
		/// <returns>
		/// A collection of <see cref="PushApplication"/> objects.
		/// </returns>
		IEnumerable<PushApplication> FindByType(PushApplicationType type);

		/// <summary>
		/// Updates the push application.
		/// </summary>
		/// <param name="application">The application.</param>
		void UpdatePushApplication(PushApplication application);
	}
}
